package org.swan.web.user.mapper;

import org.apache.ibatis.annotations.*;
import org.swan.web.user.bean.UserExtensionBean;

import java.util.List;
import java.util.Optional;


public interface UserExtensionMapper {
    @Insert("insert into user_extension ( user_id , attribute , value , description ) VALUES ( #{userId} , #{attribute} , #{value} , #{description})")
    @Options(useGeneratedKeys = true,keyProperty = "userExtensionId")
    long add(UserExtensionBean ub);
    @Select("select * from user_extension where user_extension_id = #{id}")
    Optional<UserExtensionBean> getById(@Param("id") long id);
    @Update("update user_extension set attribute = #{attribute} ,value = #{value}  where user_extension_id = #{userExtensionId}  ")
    long updateById(UserExtensionBean UserExtensionBean);
    @Delete("delete from user_extension where user_extension_id = #{UserExtensionId}")
    long deleteById(@Param("UserExtensionId") long UserExtensionId);
    @Select("select * from user_extension limit #{rows} offset #{offset}")
    List<UserExtensionBean> list(@Param("offset") int offset,@Param("rows") int rows);
}
